// 食品模型文件

const mongoose = require('../config/db')

const foodSchema = new mongoose.Schema(
    {
        // 食品id
        foodId: { type: String, required: true },

        // 数量
        foodNum: { type: Number, required: true },

        //  用户id
        userId: { type: mongoose.SchemaTypes.ObjectId, ref: 'user', required: true },

        // 用户名
        username: { type: String, required: true }
    }
)

// 创建模型
const FoodModel = mongoose.model('food', foodSchema)

module.exports = FoodModel